﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SharpErp.Common.Util
{
    public class ClientContext
    {

        public delegate void CurrentStaffChangedDelegate(object oldStaff, object newStaff);

        public CurrentStaffChangedDelegate OnCurrentStaffChanged { get; set; }

        private object _staff = null;
        public object CurrentStaff
        {
            get { return _staff; }
            set
            {
                var oldStaff = _staff; _staff = value;
                if (OnCurrentStaffChanged != null) OnCurrentStaffChanged.Invoke(oldStaff, _staff);
            }
        }

        private ClientContext() { }

        private static ClientContext instance;

        public static ClientContext GetInstance()
        {
            if (instance != null) return instance;
            instance = new ClientContext();
            return instance;
        }


    }

    public class ServerContext
    {
        private ServerContext() { }

        private static ServerContext instance;

        public static ServerContext GetInstance()
        {
            if (instance != null) return instance;
            instance = new ServerContext();
            return instance;
        }
    }
}
